/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.Objects;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

/**
 *
 * @author Juarez
 */
@ManagedBean
@SessionScoped
public class ClienteBeanTeste {
    
    public String adicionaCliente(){
        clienteDAO.salvar(cliente);
        return "index";
    }

     public String removeCliente(){
        clienteDAO.removeCliente(cliente);
        return "sucesso";
    }
    @Override
    public int hashCode() {
        int hash = 5;
        hash = 17 * hash + Objects.hashCode(this.cliente);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ClienteBeanTeste other = (ClienteBeanTeste) obj;
        if (!Objects.equals(this.cliente, other.cliente)) {
            return false;
        }
        return true;
    }

    /**
     * Creates a new instance of ClienteBean
     */
    
    private ClienteTeste cliente = new ClienteTeste();
    private ClienteDAOTeste clienteDAO = new ClienteDAOTeste();

    public ClienteTeste getCliente() {
        return cliente;
    }

    public void setCliente(ClienteTeste cliente) {
        this.cliente = cliente;
    }
    
    public ClienteBeanTeste() {
    }
    
}
